﻿using System;
using System.Windows.Forms;

namespace CodeLibrary.Controls.Dialogs
{
    public partial class InputDialog : Form
    {
        private string _result = "";
        public string Result 
        {
            get { return _result; }
        }

        private InputDialog()
        {
            InitializeComponent();
        }

        public static string ShowInputDialog(string property,  string initContent="", string caption = "")
        {
            InputDialog oInputDialog = new InputDialog
                                           {
                                               txtContent = {Text = initContent},
                                               lblProperty = {Text = property},
                                               Text = caption
                                           };
            oInputDialog.ShowDialog();
            return oInputDialog.Result;
        }

        private void txtContent_TextChanged(object sender, EventArgs e)
        {
            _result = txtContent.Text;
        }
    }
}
